﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace Pay.Data {
    public partial class BillDetailMap
        : System.Data.Entity.ModelConfiguration.EntityTypeConfiguration<BillDetail> {
        public BillDetailMap() {
            // table
            ToTable("mc_BillDetail", "dbo");

            // keys
            HasKey(t => t.Id);

            // Properties
            Property(t => t.Id)
                .HasColumnName("Id")
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity)
                .IsRequired();
            Property(t => t.BillId)
                .HasColumnName("BillId")
                .IsRequired();
            Property(t => t.PayId)
                .HasColumnName("PayId")
                .IsRequired();
            Property(t => t.BillType)
                .HasColumnName("BillType")
                .IsRequired();
            Property(t => t.Amount)
                .HasColumnName("Amount")
                .HasPrecision(18, 6)
                .IsRequired();
            Property(t => t.Balance)
                .HasColumnName("Balance")
                .HasPrecision(18, 6)
                .IsRequired();
            Property(t => t.Status)
                .HasColumnName("Status")
                .IsRequired();
            Property(t => t.CreateTime)
                .HasColumnName("CreateTime")
                .IsRequired();

            // Relationships
            HasRequired(t => t.Bill)
                .WithMany()
                .HasForeignKey(d => d.BillId)
                .WillCascadeOnDelete(false);
            HasRequired(t => t.PayInfo)
                .WithMany()
                .HasForeignKey(d => d.PayId)
                .WillCascadeOnDelete(false);
        }
    }
}
